<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>create_ocr_class_knn [HALCON算子参考手册]</title>
<style type="text/css">
      body {
    color: #000000;
    background-color: #ffffff;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
}

.body_main {
    margin-left: 35px;
    margin-right: 35px;
}

@media screen and (min-width:992px) {

    .body_main {
        margin-left: 10%;
        margin-right: 10%;
    }

    table.toctable {
        width: 80%
    }
}

@media screen and (min-width:1400px) {

    .body_main {
        margin-left: 15%;
        margin-right: 15%;
    }

    table.toctable {
        width: 70%
    }
}

body>div ul ul {
    margin-left: inherit;
}

a:link {
    color: #0044cc;
}

a:link,
a:visited {
    text-decoration: none;
}

a:link:hover,
a:visited:hover {
    text-decoration: underline;
}

th {
    text-align: left;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    text-rendering: optimizeLegibility;
    color: #666666;
}

code {
    font-family: monospace,monospace;
}

h1 a.halconoperator {
    font-family: Arial, Helvetica, sans-serif;
    color: #666666;
}

h2 a.halconoperator {
    font-family: Arial, Helvetica, sans-serif;
    color: #666666;
}

hr {
    border: 0;
    border-top: solid 1px #f28d26;
}

.pre {
    display: block;
    padding-bottom: 1ex;
    font-family: monospace;
    white-space: pre;
}

pre {
    font-family: monospace, monospace;
    padding: 1ex;
    white-space: pre-wrap;
}

.toc {
    font-size: 80%;
    border-top: 1px dashed #f28d26;
    border-bottom: 1px dashed #f28d26;
    padding-top: 5px;
    padding-bottom: 5px;
}

.inv {
    margin: 0;
    border: 0;
    padding: 0;
}

.banner {
    color: #666666;
    padding-left: 1em;
}

.logo {
    background-color: white;
}

.keyboard {
    font-size: 80%;
    padding-left: 3px;
    padding-right: 3px;
    border-radius: 5px;
    border-width: 1px;
    border-style: solid;
    border-color: #f28d26;
    background-color: #f3f3f3;
}

.warning {
    margin-top: 2ex;
    margin-bottom: 1ex;
    padding: 10px;
    text-align: center;
    border: 1px solid;
    color: #bb0000;
    background-color: #fff7f7
}

.imprint {
    margin-top: 1ex;
    font-size: 80%;
    color: #666666;
}

.imprinthead {
    font-weight: bolder;
    color: #666666;
}

.indexlink {
    text-align: right;
    padding-bottom: 5px;
}

.postscript {
    margin-top: 2ex;
    font-size: 80%;
    color: #666666
}

.evenrow {
    background-color: #e7e7ef;
    vertical-align: top;
}

.oddrow {
    background-color: #f7f7ff;
    vertical-align: top;
}

.headrow {
    background-color: #97979f;
    color: #ffffff;
    vertical-align: top;
}

.logorow {
    vertical-align: top;
}

.error {
    color: red;
}

.var {
    font-style: italic
}

.halconoperator {
    font-family: monospace, monospace;
}

span.operator {
    font-family: monospace, monospace;
}

span.procedure {
    font-family: monospace, monospace;
}

span.operation {
    font-family: monospace, monospace;
}

span.feature {
    font-family: Arial, Helvetica, Homerton, sans-serif;
}

ul {
    padding-left: 1.2em;
}

li.dot {
    list-style-type: square;
    color: #f28d26;
}

.breadcrumb {
    font-size: 80%;
    color: white;
    background-color: #062d64;
    margin-bottom: 20px;
    padding-left: 35px;
    padding-right: 35px;
    padding-bottom: 15px;
}

.webbar {
    font-size: 80%;
    background-color: #dddddd;
    margin-top: 0px;
    margin-left: -35px;
    margin-right: -35px;
    margin-bottom: 0px;
    padding-top: 5px;
    padding-left: 35px;
    padding-right: 35px;
    padding-bottom: 5px;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    border-top: 1px dashed #f28d26;
    font-size: 80%;
    color: #666666;
    padding-bottom: 8px;
}

.footer .socialmedia a {
    padding-left: 7px;
}

.socialmedia {
    padding-top: 10px;
}

.copyright {
    margin-top: 19px;
}

.breadcrumb a {
    color: #ffffff;
    border-bottom: 1px solid white;
}

.breadcrumb a:link:hover,
.breadcrumb a:visited:hover {
    text-decoration: none;
    border-bottom: none;
}

.heading {
    margin-top: 1ex;
    font-size: 110%;
    font-weight: bold;
    color: #666666;
}

.text {
    color: black;
}

.example {
    font-size: 80%;
    background-color: #f3f3f3;
    border: 1px dashed #666666;
    padding: 10px;
}

.displaymath {
    display: block;
    text-align: center;
    margin-top: 1ex;
    margin-bottom: 1ex;
}

.title {
    float: left;
    padding-top: 3px;
    padding-bottom: 3px;
}

.signnote {
    font-family: Arial, Helvetica, Homerton, sans-serif;
    font-size: 80%;
    color: #666666;
    font-weight: lighter;
    font-style: italic
}

.par {
    margin-bottom: 1.5em;
}

.parhead {
    text-align: right;
}

.parname {
    float: left;
}

.pardesc {
    font-size: 85%;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    margin-left: 2em;
}

.parcat {
    color: #666;
    font-weight: bold;
}

*[data-if=cpp],
*[data-if=c],
*[data-if=dotnet],
*[data-if=com],
*[data-if=python] {
    display: none;
}

.tabbar {
    text-align: right;
    border-bottom: 1px solid #f28d26;
    margin-bottom: 0.5em;
}

ul.tabs {
    padding-top: 3px;
    padding-bottom: 3px;
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 80%
}

ul.tabs li {
    padding-top: 3px;
    padding-bottom: 3px;
    display: inline;
    overflow: hidden;
    list-style-type: none;
    margin: 0;
    margin-left: 8px;
    border-top: 1px solid #666;
    border-left: 1px solid #666;
    border-right: 1px solid #666;
}

ul.tabs li.active {
    border-left: 1px solid #f28d26;
    border-right: 1px solid #f28d26;
    border-top: 1px solid #f28d26;
    border-bottom: 1px solid #fff;
}

ul.tabs li.inactive {
    background-color: #eee;
}

ul.tabs li a {
    padding-left: 5px;
    padding-right: 5px;
    color: #666;
}

ul.tabs li a:link:hover {
    text-decoration: none;
}

ul.tabs li.inactive a {
    color: #666;
}

ul.tabs li.active a {
    color: black;
}

dl.generic dd {
    margin-bottom: 1em;
}

.pari {
    color: olive;
}

.paro {
    color: maroon;
}

.comment {
    font-size: 80%;
    color: green;
    white-space: nowrap;
}

table.grid {
    border-collapse: collapse;
}

table.grid td {
    padding: 5px;
    border: 1px solid;
}

table.layout {
    border: 0px;
}

table.layout td {
    padding: 5px;
}

table.table {
    border-collapse: collapse;
}

table.table td {
    padding: 5px;
    border-left: 0px;
    border-right: 0px;
}

table.table tr:last-child {
    border-bottom: 1px solid;
}

table.table th {
    padding: 5px;
    border-top: 1px solid;
    border-bottom: 1px solid;
    border-left: 0px;
    border-right: 0px;
}

.details_summary {
    cursor: pointer;
}

table.toctable {
    width: 100%;
}

table.toctable col:first-child {
    width: 20%;
}

table.toctable col:nth-last-child(2) {
    width: 8%;
}

table.altcolored tr:nth-child(even) {
    background-color: #f3f3f3;
}

    </style>
<!--OP_REF_STYLE_END-->
<script>
    <!--
var active_lang='hdevelop';function switchVisibility(obj,active_lang,new_lang)
{var display_style='inline';
for(var i=0;i<obj.length;i++)
{if(obj.item(i).getAttribute('data-if')==new_lang)
{obj.item(i).style.display=display_style;}
if(obj.item(i).getAttribute('data-if')==active_lang)
{obj.item(i).style.display='none';}}
return;}
function toggleLanguage(new_lang,initial)
{if(active_lang!=new_lang)
{var lis=document.getElementsByTagName('li');for(var i=0;i<lis.length;i++)
{if(lis.item(i).id=='syn-'+new_lang)
{lis.item(i).className='active';}
else
{lis.item(i).className='inactive';}}
var divs=document.getElementsByTagName('div');var spans=document.getElementsByTagName('span');switchVisibility(divs,active_lang,new_lang);switchVisibility(spans,active_lang,new_lang);if(!initial)
{setCookie("halcon_reference_language",new_lang,null,null);}
active_lang=new_lang;}
return;}
function setCookie(name,value,domain,exp_offset,path,secure)
{localStorage.setItem(name,value);}
function getCookie(name)
{return localStorage.getItem(name);}
function initialize()
{var qs=location.href.split('?')[1];var qs_lang_raw=location.href.split('interface=')[1];var qs_lang;if(qs_lang_raw)
{qs_lang=qs_lang_raw.split('#')[0];}
var cookie_lang=getCookie("halcon_reference_language");var new_lang;if((qs_lang=="hdevelop")||(qs_lang=="dotnet")||(qs_lang=="python")||(qs_lang=="cpp")||(qs_lang=="c"))
{new_lang=qs_lang;setCookie("halcon_reference_language",new_lang,null,null);}
else if((cookie_lang=="hdevelop")||(cookie_lang=="dotnet")||(cookie_lang=="python")||(cookie_lang=="cpp")||(cookie_lang=="c"))
{new_lang=cookie_lang;}
else
{new_lang="hdevelop";}
toggleLanguage(new_lang,1);return;}
-->

  </script>
</head>
<body onload="initialize();">
<div class="breadcrumb">
<br class="inv"><a href="index.html">目录</a> / <a href="toc_ocr.html">OCR</a> / <a href="toc_ocr_knearestneighbor.html">K-最近邻</a><br class="inv">
</div>
<div class="body_main">
<div class="tabbar"><ul class="tabs">
<li id="syn-hdevelop" class="active"><a href="javascript:void(0);" onclick="toggleLanguage('hdevelop')" onfocus="blur()">HDevelop</a></li>
<li id="syn-dotnet" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('dotnet')" onfocus="blur()">.NET</a></li>
<li id="syn-python" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('python')" onfocus="blur()">Python</a></li>
<li id="syn-cpp" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('cpp')" onfocus="blur()">C++</a></li>
<li id="syn-c" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('c')" onfocus="blur()">C</a></li>
</ul></div>
<div class="indexlink">
<a href="index_classes.html"><span data-if="dotnet" style="display:none;">类别</span><span data-if="cpp" style="display:none;">类别</span></a><span data-if="dotnet" style="display:none;"> | </span><span data-if="cpp" style="display:none;"> | </span><a href="index_by_name.html">算子列表</a>
</div>
<!--OP_REF_HEADER_END-->
<h1 id="sec_name">
<span data-if="hdevelop" style="display:inline;">create_ocr_class_knn</span><span data-if="c" style="display:none;">T_create_ocr_class_knn</span><span data-if="cpp" style="display:none;">CreateOcrClassKnn</span><span data-if="dotnet" style="display:none;">CreateOcrClassKnn</span><span data-if="python" style="display:none;">create_ocr_class_knn</span> (算子名称)</h1>
<h2>名称</h2>
<p><code><span data-if="hdevelop" style="display:inline;">create_ocr_class_knn</span><span data-if="c" style="display:none;">T_create_ocr_class_knn</span><span data-if="cpp" style="display:none;">CreateOcrClassKnn</span><span data-if="dotnet" style="display:none;">CreateOcrClassKnn</span><span data-if="python" style="display:none;">create_ocr_class_knn</span></code> — Create an OCR classifier using a k-Nearest Neighbor (k-NN) classifier.</p>
<h2 id="sec_synopsis">参数签名</h2>
<div data-if="hdevelop" style="display:inline;">
<p>
<code><b>create_ocr_class_knn</b>( :  : <a href="#WidthCharacter"><i>WidthCharacter</i></a>, <a href="#HeightCharacter"><i>HeightCharacter</i></a>, <a href="#Interpolation"><i>Interpolation</i></a>, <a href="#Features"><i>特征</i></a>, <a href="#Characters"><i>Characters</i></a>, <a href="#GenParamName"><i>GenParamName</i></a>, <a href="#GenParamValue"><i>GenParamValue</i></a> : <a href="#OCRHandle"><i>OCRHandle</i></a>)</code></p>
</div>
<div data-if="c" style="display:none;">
<p>
<code>Herror <b>T_create_ocr_class_knn</b>(const Htuple <a href="#WidthCharacter"><i>WidthCharacter</i></a>, const Htuple <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const Htuple <a href="#Interpolation"><i>Interpolation</i></a>, const Htuple <a href="#Features"><i>特征</i></a>, const Htuple <a href="#Characters"><i>Characters</i></a>, const Htuple <a href="#GenParamName"><i>GenParamName</i></a>, const Htuple <a href="#GenParamValue"><i>GenParamValue</i></a>, Htuple* <a href="#OCRHandle"><i>OCRHandle</i></a>)</code></p>
</div>
<div data-if="cpp" style="display:none;">
<p>
<code>void <b>CreateOcrClassKnn</b>(const HTuple&amp; <a href="#WidthCharacter"><i>WidthCharacter</i></a>, const HTuple&amp; <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const HTuple&amp; <a href="#Interpolation"><i>Interpolation</i></a>, const HTuple&amp; <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>, HTuple* <a href="#OCRHandle"><i>OCRHandle</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>HOCRKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const HString&amp; <a href="#Interpolation"><i>Interpolation</i></a>, const HTuple&amp; <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>HOCRKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const HString&amp; <a href="#Interpolation"><i>Interpolation</i></a>, const HString&amp; <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>HOCRKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const char* <a href="#Interpolation"><i>Interpolation</i></a>, const char* <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>HOCRKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const wchar_t* <a href="#Interpolation"><i>Interpolation</i></a>, const wchar_t* <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)  <span class="signnote">
            (
            Windows only)
          </span></code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>CreateOcrClassKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const HString&amp; <a href="#Interpolation"><i>Interpolation</i></a>, const HTuple&amp; <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>CreateOcrClassKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const HString&amp; <a href="#Interpolation"><i>Interpolation</i></a>, const HString&amp; <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>CreateOcrClassKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const char* <a href="#Interpolation"><i>Interpolation</i></a>, const char* <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>::<b>CreateOcrClassKnn</b>(Hlong <a href="#WidthCharacter"><i>WidthCharacter</i></a>, Hlong <a href="#HeightCharacter"><i>HeightCharacter</i></a>, const wchar_t* <a href="#Interpolation"><i>Interpolation</i></a>, const wchar_t* <a href="#Features"><i>特征</i></a>, const HTuple&amp; <a href="#Characters"><i>Characters</i></a>, const HTuple&amp; <a href="#GenParamName"><i>GenParamName</i></a>, const HTuple&amp; <a href="#GenParamValue"><i>GenParamValue</i></a>)  <span class="signnote">
            (
            Windows only)
          </span></code></p>
</div>
<div data-if="com" style="display:none;"></div>
<div data-if="dotnet" style="display:none;">
<p>
<code>static void <a href="HOperatorSet.html">HOperatorSet</a>.<b>CreateOcrClassKnn</b>(<a href="HTuple.html">HTuple</a> <a href="#WidthCharacter"><i>widthCharacter</i></a>, <a href="HTuple.html">HTuple</a> <a href="#HeightCharacter"><i>heightCharacter</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Interpolation"><i>interpolation</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Features"><i>特征</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Characters"><i>characters</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamName"><i>genParamName</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamValue"><i>genParamValue</i></a>, out <a href="HTuple.html">HTuple</a> <a href="#OCRHandle"><i>OCRHandle</i></a>)</code></p>
<p>
<code>public <a href="HOCRKnn.html">HOCRKnn</a>(int <a href="#WidthCharacter"><i>widthCharacter</i></a>, int <a href="#HeightCharacter"><i>heightCharacter</i></a>, string <a href="#Interpolation"><i>interpolation</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Features"><i>特征</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Characters"><i>characters</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamName"><i>genParamName</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamValue"><i>genParamValue</i></a>)</code></p>
<p>
<code>public <a href="HOCRKnn.html">HOCRKnn</a>(int <a href="#WidthCharacter"><i>widthCharacter</i></a>, int <a href="#HeightCharacter"><i>heightCharacter</i></a>, string <a href="#Interpolation"><i>interpolation</i></a>, string <a href="#Features"><i>特征</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Characters"><i>characters</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamName"><i>genParamName</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamValue"><i>genParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>.<b>CreateOcrClassKnn</b>(int <a href="#WidthCharacter"><i>widthCharacter</i></a>, int <a href="#HeightCharacter"><i>heightCharacter</i></a>, string <a href="#Interpolation"><i>interpolation</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Features"><i>特征</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Characters"><i>characters</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamName"><i>genParamName</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamValue"><i>genParamValue</i></a>)</code></p>
<p>
<code>void <a href="HOCRKnn.html">HOCRKnn</a>.<b>CreateOcrClassKnn</b>(int <a href="#WidthCharacter"><i>widthCharacter</i></a>, int <a href="#HeightCharacter"><i>heightCharacter</i></a>, string <a href="#Interpolation"><i>interpolation</i></a>, string <a href="#Features"><i>特征</i></a>, <a href="HTuple.html">HTuple</a> <a href="#Characters"><i>characters</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamName"><i>genParamName</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParamValue"><i>genParamValue</i></a>)</code></p>
</div>
<div data-if="python" style="display:none;">
<p>
<code>def <b>create_ocr_class_knn</b>(<a href="#WidthCharacter"><i>width_character</i></a>: int, <a href="#HeightCharacter"><i>height_character</i></a>: int, <a href="#Interpolation"><i>interpolation</i></a>: str, <a href="#Features"><i>特征</i></a>: MaybeSequence[str], <a href="#Characters"><i>characters</i></a>: Sequence[str], <a href="#GenParamName"><i>gen_param_name</i></a>: Sequence[str], <a href="#GenParamValue"><i>gen_param_value</i></a>: Sequence[Union[int, str]]) -&gt; HHandle</code></p>
</div>
<h2 id="sec_description">描述</h2>
<p><code><span data-if="hdevelop" style="display:inline">create_ocr_class_knn</span><span data-if="c" style="display:none">create_ocr_class_knn</span><span data-if="cpp" style="display:none">CreateOcrClassKnn</span><span data-if="com" style="display:none">CreateOcrClassKnn</span><span data-if="dotnet" style="display:none">CreateOcrClassKnn</span><span data-if="python" style="display:none">create_ocr_class_knn</span></code> creates an OCR classifier that uses a
k-Nearest Neighbor (k-NN).  The handle of the k-NN classifier is
returned in <a href="#OCRHandle"><i><code><span data-if="hdevelop" style="display:inline">OCRHandle</span><span data-if="c" style="display:none">OCRHandle</span><span data-if="cpp" style="display:none">OCRHandle</span><span data-if="com" style="display:none">OCRHandle</span><span data-if="dotnet" style="display:none">OCRHandle</span><span data-if="python" style="display:none">ocrhandle</span></code></i></a>.
</p>
<p>For a description on how a k-NN works, see <a href="create_class_knn.html"><code><span data-if="hdevelop" style="display:inline">create_class_knn</span><span data-if="c" style="display:none">create_class_knn</span><span data-if="cpp" style="display:none">CreateClassKnn</span><span data-if="com" style="display:none">CreateClassKnn</span><span data-if="dotnet" style="display:none">CreateClassKnn</span><span data-if="python" style="display:none">create_class_knn</span></code></a>.
</p>
<p>The length of the feature vector of the k-NN is determined from the
features that are used for the OCR, which are passed in <a href="#Features"><i><code><span data-if="hdevelop" style="display:inline">特征</span><span data-if="c" style="display:none">特征</span><span data-if="cpp" style="display:none">特征</span><span data-if="com" style="display:none">特征</span><span data-if="dotnet" style="display:none">特征</span><span data-if="python" style="display:none">特征</span></code></i></a>.
The features are described below.  The number of classes is determined
from the names of the characters which are passed in <a href="#Characters"><i><code><span data-if="hdevelop" style="display:inline">Characters</span><span data-if="c" style="display:none">Characters</span><span data-if="cpp" style="display:none">Characters</span><span data-if="com" style="display:none">Characters</span><span data-if="dotnet" style="display:none">characters</span><span data-if="python" style="display:none">characters</span></code></i></a>.
</p>
<p><a href="#Features"><i><code><span data-if="hdevelop" style="display:inline">特征</span><span data-if="c" style="display:none">特征</span><span data-if="cpp" style="display:none">特征</span><span data-if="com" style="display:none">特征</span><span data-if="dotnet" style="display:none">特征</span><span data-if="python" style="display:none">特征</span></code></i></a> can contain a tuple of several
feature names. Each of these names results in one or more
features to be calculated for the classifier.  Some of the feature
names compute gray value features (e.g., <i><span data-if="hdevelop" style="display:inline">'pixel_invar'</span><span data-if="c" style="display:none">"pixel_invar"</span><span data-if="cpp" style="display:none">"pixel_invar"</span><span data-if="com" style="display:none">"pixel_invar"</span><span data-if="dotnet" style="display:none">"pixel_invar"</span><span data-if="python" style="display:none">"pixel_invar"</span></i>).
Because a classifier requires a constant number of features (input
variables), a character to be classified is transformed to a
standard size, which is determined by <a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> and
<a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a>. The interpolation to be used for the
transformation is determined by <a href="#Interpolation"><i><code><span data-if="hdevelop" style="display:inline">Interpolation</span><span data-if="c" style="display:none">Interpolation</span><span data-if="cpp" style="display:none">Interpolation</span><span data-if="com" style="display:none">Interpolation</span><span data-if="dotnet" style="display:none">interpolation</span><span data-if="python" style="display:none">interpolation</span></code></i></a>.  It has the
same meaning as in <a href="affine_trans_image.html"><code><span data-if="hdevelop" style="display:inline">affine_trans_image</span><span data-if="c" style="display:none">affine_trans_image</span><span data-if="cpp" style="display:none">AffineTransImage</span><span data-if="com" style="display:none">AffineTransImage</span><span data-if="dotnet" style="display:none">AffineTransImage</span><span data-if="python" style="display:none">affine_trans_image</span></code></a>.  The interpolation
should be chosen such that no aliasing effects occur in the
transformation.  For most applications, <a href="#Interpolation"><i><code><span data-if="hdevelop" style="display:inline">Interpolation</span><span data-if="c" style="display:none">Interpolation</span><span data-if="cpp" style="display:none">Interpolation</span><span data-if="com" style="display:none">Interpolation</span><span data-if="dotnet" style="display:none">interpolation</span><span data-if="python" style="display:none">interpolation</span></code></i></a> =
<i><span data-if="hdevelop" style="display:inline">'constant'</span><span data-if="c" style="display:none">"constant"</span><span data-if="cpp" style="display:none">"constant"</span><span data-if="com" style="display:none">"constant"</span><span data-if="dotnet" style="display:none">"constant"</span><span data-if="python" style="display:none">"constant"</span></i> should be used.  It should be noted that the
size of the transformed character is not chosen too large, because
the generalization properties of the classifier may become bad for
large sizes.  In particular, large sizes will cause
small segmentation errors to have a large influence on the
computed features if gray value features are used.  This happens
because segmentation errors will change the smallest enclosing
rectangle of the regions, which results in characters
are zoomed differently than the characters in the training set.  In
most applications, sizes between 6x8 and
10x14 should be used.
</p>
<p>The parameter <a href="#Features"><i><code><span data-if="hdevelop" style="display:inline">特征</span><span data-if="c" style="display:none">特征</span><span data-if="cpp" style="display:none">特征</span><span data-if="com" style="display:none">特征</span><span data-if="dotnet" style="display:none">特征</span><span data-if="python" style="display:none">特征</span></code></i></a> can contain the following feature
names for the classification of the characters.
</p>
<dl class="generic">

<dt><b><i><span data-if="hdevelop" style="display:inline">'default'</span><span data-if="c" style="display:none">"default"</span><span data-if="cpp" style="display:none">"default"</span><span data-if="com" style="display:none">"default"</span><span data-if="dotnet" style="display:none">"default"</span><span data-if="python" style="display:none">"default"</span></i>:</b></dt>
<dd>
<p>

<i><span data-if="hdevelop" style="display:inline">'ratio'</span><span data-if="c" style="display:none">"ratio"</span><span data-if="cpp" style="display:none">"ratio"</span><span data-if="com" style="display:none">"ratio"</span><span data-if="dotnet" style="display:none">"ratio"</span><span data-if="python" style="display:none">"ratio"</span></i> and <i><span data-if="hdevelop" style="display:inline">'pixel_invar'</span><span data-if="c" style="display:none">"pixel_invar"</span><span data-if="cpp" style="display:none">"pixel_invar"</span><span data-if="com" style="display:none">"pixel_invar"</span><span data-if="dotnet" style="display:none">"pixel_invar"</span><span data-if="python" style="display:none">"pixel_invar"</span></i> are selected.
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'pixel'</span><span data-if="c" style="display:none">"pixel"</span><span data-if="cpp" style="display:none">"pixel"</span><span data-if="com" style="display:none">"pixel"</span><span data-if="dotnet" style="display:none">"pixel"</span><span data-if="python" style="display:none">"pixel"</span></i>:</b></dt>
<dd>
<p>

Gray values of the character (<a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> x
<a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a> features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'pixel_invar'</span><span data-if="c" style="display:none">"pixel_invar"</span><span data-if="cpp" style="display:none">"pixel_invar"</span><span data-if="com" style="display:none">"pixel_invar"</span><span data-if="dotnet" style="display:none">"pixel_invar"</span><span data-if="python" style="display:none">"pixel_invar"</span></i>:</b></dt>
<dd>
<p>

Gray values of the character with maximum scaling of the gray
values (<a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> x <a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a>
features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'pixel_binary'</span><span data-if="c" style="display:none">"pixel_binary"</span><span data-if="cpp" style="display:none">"pixel_binary"</span><span data-if="com" style="display:none">"pixel_binary"</span><span data-if="dotnet" style="display:none">"pixel_binary"</span><span data-if="python" style="display:none">"pixel_binary"</span></i>:</b></dt>
<dd>
<p>

Region of the character as a binary image zoomed to a size of
<a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> x <a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a>
(<a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> x <a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a>
features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'gradient_8dir'</span><span data-if="c" style="display:none">"gradient_8dir"</span><span data-if="cpp" style="display:none">"gradient_8dir"</span><span data-if="com" style="display:none">"gradient_8dir"</span><span data-if="dotnet" style="display:none">"gradient_8dir"</span><span data-if="python" style="display:none">"gradient_8dir"</span></i>:</b></dt>
<dd>
<p>

Gradients are computed on the character image.  The gradient
directions are discretized into 8 directions.  The amplitude image
is decomposed into 8 channels according to these discretized
directions.  25 samples on a 5x5 grid are extracted from
each channel. These samples are used as features (200 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'projection_horizontal'</span><span data-if="c" style="display:none">"projection_horizontal"</span><span data-if="cpp" style="display:none">"projection_horizontal"</span><span data-if="com" style="display:none">"projection_horizontal"</span><span data-if="dotnet" style="display:none">"projection_horizontal"</span><span data-if="python" style="display:none">"projection_horizontal"</span></i>:</b></dt>
<dd>
<p>

Horizontal projection of the gray values (see
<a href="gray_projections.html"><code><span data-if="hdevelop" style="display:inline">gray_projections</span><span data-if="c" style="display:none">gray_projections</span><span data-if="cpp" style="display:none">GrayProjections</span><span data-if="com" style="display:none">GrayProjections</span><span data-if="dotnet" style="display:none">GrayProjections</span><span data-if="python" style="display:none">gray_projections</span></code></a>, <a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a> features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'projection_horizontal_invar'</span><span data-if="c" style="display:none">"projection_horizontal_invar"</span><span data-if="cpp" style="display:none">"projection_horizontal_invar"</span><span data-if="com" style="display:none">"projection_horizontal_invar"</span><span data-if="dotnet" style="display:none">"projection_horizontal_invar"</span><span data-if="python" style="display:none">"projection_horizontal_invar"</span></i>:</b></dt>
<dd>
<p>

Maximally scaled horizontal projection of the gray values
(<a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a> features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'projection_vertical'</span><span data-if="c" style="display:none">"projection_vertical"</span><span data-if="cpp" style="display:none">"projection_vertical"</span><span data-if="com" style="display:none">"projection_vertical"</span><span data-if="dotnet" style="display:none">"projection_vertical"</span><span data-if="python" style="display:none">"projection_vertical"</span></i>:</b></dt>
<dd>
<p>

Vertical projection of the gray values (see
<a href="gray_projections.html"><code><span data-if="hdevelop" style="display:inline">gray_projections</span><span data-if="c" style="display:none">gray_projections</span><span data-if="cpp" style="display:none">GrayProjections</span><span data-if="com" style="display:none">GrayProjections</span><span data-if="dotnet" style="display:none">GrayProjections</span><span data-if="python" style="display:none">gray_projections</span></code></a>, <a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'projection_vertical_invar'</span><span data-if="c" style="display:none">"projection_vertical_invar"</span><span data-if="cpp" style="display:none">"projection_vertical_invar"</span><span data-if="com" style="display:none">"projection_vertical_invar"</span><span data-if="dotnet" style="display:none">"projection_vertical_invar"</span><span data-if="python" style="display:none">"projection_vertical_invar"</span></i>:</b></dt>
<dd>
<p>

Maximally scaled vertical projection of the gray values
(<a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'ratio'</span><span data-if="c" style="display:none">"ratio"</span><span data-if="cpp" style="display:none">"ratio"</span><span data-if="com" style="display:none">"ratio"</span><span data-if="dotnet" style="display:none">"ratio"</span><span data-if="python" style="display:none">"ratio"</span></i>:</b></dt>
<dd>
<p>

Aspect ratio of the character (see
<a href="height_width_ratio.html"><code><span data-if="hdevelop" style="display:inline">height_width_ratio</span><span data-if="c" style="display:none">height_width_ratio</span><span data-if="cpp" style="display:none">HeightWidthRatio</span><span data-if="com" style="display:none">HeightWidthRatio</span><span data-if="dotnet" style="display:none">HeightWidthRatio</span><span data-if="python" style="display:none">height_width_ratio</span></code></a>, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'anisometry'</span><span data-if="c" style="display:none">"anisometry"</span><span data-if="cpp" style="display:none">"anisometry"</span><span data-if="com" style="display:none">"anisometry"</span><span data-if="dotnet" style="display:none">"anisometry"</span><span data-if="python" style="display:none">"anisometry"</span></i>:</b></dt>
<dd>
<p>

Anisometry of the character (see <a href="eccentricity.html"><code><span data-if="hdevelop" style="display:inline">eccentricity</span><span data-if="c" style="display:none">eccentricity</span><span data-if="cpp" style="display:none">Eccentricity</span><span data-if="com" style="display:none">Eccentricity</span><span data-if="dotnet" style="display:none">Eccentricity</span><span data-if="python" style="display:none">eccentricity</span></code></a>, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'width'</span><span data-if="c" style="display:none">"width"</span><span data-if="cpp" style="display:none">"width"</span><span data-if="com" style="display:none">"width"</span><span data-if="dotnet" style="display:none">"width"</span><span data-if="python" style="display:none">"width"</span></i>:</b></dt>
<dd>
<p>

Width of the character before scaling the character to the
standard size (not scale-invariant, see
<a href="height_width_ratio.html"><code><span data-if="hdevelop" style="display:inline">height_width_ratio</span><span data-if="c" style="display:none">height_width_ratio</span><span data-if="cpp" style="display:none">HeightWidthRatio</span><span data-if="com" style="display:none">HeightWidthRatio</span><span data-if="dotnet" style="display:none">HeightWidthRatio</span><span data-if="python" style="display:none">height_width_ratio</span></code></a>, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'height'</span><span data-if="c" style="display:none">"height"</span><span data-if="cpp" style="display:none">"height"</span><span data-if="com" style="display:none">"height"</span><span data-if="dotnet" style="display:none">"height"</span><span data-if="python" style="display:none">"height"</span></i>:</b></dt>
<dd>
<p>

Height of the character before scaling the character to the
standard size (not scale-invariant, see
<a href="height_width_ratio.html"><code><span data-if="hdevelop" style="display:inline">height_width_ratio</span><span data-if="c" style="display:none">height_width_ratio</span><span data-if="cpp" style="display:none">HeightWidthRatio</span><span data-if="com" style="display:none">HeightWidthRatio</span><span data-if="dotnet" style="display:none">HeightWidthRatio</span><span data-if="python" style="display:none">height_width_ratio</span></code></a>, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'zoom_factor'</span><span data-if="c" style="display:none">"zoom_factor"</span><span data-if="cpp" style="display:none">"zoom_factor"</span><span data-if="com" style="display:none">"zoom_factor"</span><span data-if="dotnet" style="display:none">"zoom_factor"</span><span data-if="python" style="display:none">"zoom_factor"</span></i>:</b></dt>
<dd>
<p>

Difference in size between the character and the values
<a href="#WidthCharacter"><i><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></i></a> and <a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a> (not
scale-invariant, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'foreground'</span><span data-if="c" style="display:none">"foreground"</span><span data-if="cpp" style="display:none">"foreground"</span><span data-if="com" style="display:none">"foreground"</span><span data-if="dotnet" style="display:none">"foreground"</span><span data-if="python" style="display:none">"foreground"</span></i>:</b></dt>
<dd>
<p>

Fraction of pixels in the foreground (1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'foreground_grid_9'</span><span data-if="c" style="display:none">"foreground_grid_9"</span><span data-if="cpp" style="display:none">"foreground_grid_9"</span><span data-if="com" style="display:none">"foreground_grid_9"</span><span data-if="dotnet" style="display:none">"foreground_grid_9"</span><span data-if="python" style="display:none">"foreground_grid_9"</span></i>:</b></dt>
<dd>
<p>

Fraction of pixels in the foreground in a 3x3 grid within
the smallest enclosing rectangle of the character (9 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'foreground_grid_16'</span><span data-if="c" style="display:none">"foreground_grid_16"</span><span data-if="cpp" style="display:none">"foreground_grid_16"</span><span data-if="com" style="display:none">"foreground_grid_16"</span><span data-if="dotnet" style="display:none">"foreground_grid_16"</span><span data-if="python" style="display:none">"foreground_grid_16"</span></i>:</b></dt>
<dd>
<p>

Fraction of pixels in the foreground in a 4x4 grid within
the smallest enclosing rectangle of the character (16 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'compactness'</span><span data-if="c" style="display:none">"compactness"</span><span data-if="cpp" style="display:none">"compactness"</span><span data-if="com" style="display:none">"compactness"</span><span data-if="dotnet" style="display:none">"compactness"</span><span data-if="python" style="display:none">"compactness"</span></i>:</b></dt>
<dd>
<p>

Compactness of the character (see <a href="compactness.html"><code><span data-if="hdevelop" style="display:inline">compactness</span><span data-if="c" style="display:none">compactness</span><span data-if="cpp" style="display:none">Compactness</span><span data-if="com" style="display:none">Compactness</span><span data-if="dotnet" style="display:none">Compactness</span><span data-if="python" style="display:none">compactness</span></code></a>, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'convexity'</span><span data-if="c" style="display:none">"convexity"</span><span data-if="cpp" style="display:none">"convexity"</span><span data-if="com" style="display:none">"convexity"</span><span data-if="dotnet" style="display:none">"convexity"</span><span data-if="python" style="display:none">"convexity"</span></i>:</b></dt>
<dd>
<p>

Convexity of the character (see <a href="convexity.html"><code><span data-if="hdevelop" style="display:inline">convexity</span><span data-if="c" style="display:none">convexity</span><span data-if="cpp" style="display:none">Convexity</span><span data-if="com" style="display:none">Convexity</span><span data-if="dotnet" style="display:none">Convexity</span><span data-if="python" style="display:none">convexity</span></code></a>, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'moments_region_2nd_invar'</span><span data-if="c" style="display:none">"moments_region_2nd_invar"</span><span data-if="cpp" style="display:none">"moments_region_2nd_invar"</span><span data-if="com" style="display:none">"moments_region_2nd_invar"</span><span data-if="dotnet" style="display:none">"moments_region_2nd_invar"</span><span data-if="python" style="display:none">"moments_region_2nd_invar"</span></i>:</b></dt>
<dd>
<p>

Normalized 2nd moments of the character (see
<a href="moments_region_2nd_invar.html"><code><span data-if="hdevelop" style="display:inline">moments_region_2nd_invar</span><span data-if="c" style="display:none">moments_region_2nd_invar</span><span data-if="cpp" style="display:none">MomentsRegion2ndInvar</span><span data-if="com" style="display:none">MomentsRegion2ndInvar</span><span data-if="dotnet" style="display:none">MomentsRegion2ndInvar</span><span data-if="python" style="display:none">moments_region_2nd_invar</span></code></a>, 3 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'moments_region_2nd_rel_invar'</span><span data-if="c" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="cpp" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="com" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="dotnet" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="python" style="display:none">"moments_region_2nd_rel_invar"</span></i>:</b></dt>
<dd>
<p>

Normalized 2nd relative moments of the character (see
<a href="moments_region_2nd_rel_invar.html"><code><span data-if="hdevelop" style="display:inline">moments_region_2nd_rel_invar</span><span data-if="c" style="display:none">moments_region_2nd_rel_invar</span><span data-if="cpp" style="display:none">MomentsRegion2ndRelInvar</span><span data-if="com" style="display:none">MomentsRegion2ndRelInvar</span><span data-if="dotnet" style="display:none">MomentsRegion2ndRelInvar</span><span data-if="python" style="display:none">moments_region_2nd_rel_invar</span></code></a>, 2 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'moments_region_3rd_invar'</span><span data-if="c" style="display:none">"moments_region_3rd_invar"</span><span data-if="cpp" style="display:none">"moments_region_3rd_invar"</span><span data-if="com" style="display:none">"moments_region_3rd_invar"</span><span data-if="dotnet" style="display:none">"moments_region_3rd_invar"</span><span data-if="python" style="display:none">"moments_region_3rd_invar"</span></i>:</b></dt>
<dd>
<p>

Normalized 3rd moments of the character (see
<a href="moments_region_3rd_invar.html"><code><span data-if="hdevelop" style="display:inline">moments_region_3rd_invar</span><span data-if="c" style="display:none">moments_region_3rd_invar</span><span data-if="cpp" style="display:none">MomentsRegion3rdInvar</span><span data-if="com" style="display:none">MomentsRegion3rdInvar</span><span data-if="dotnet" style="display:none">MomentsRegion3rdInvar</span><span data-if="python" style="display:none">moments_region_3rd_invar</span></code></a>, 4 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'moments_central'</span><span data-if="c" style="display:none">"moments_central"</span><span data-if="cpp" style="display:none">"moments_central"</span><span data-if="com" style="display:none">"moments_central"</span><span data-if="dotnet" style="display:none">"moments_central"</span><span data-if="python" style="display:none">"moments_central"</span></i>:</b></dt>
<dd>
<p>

Normalized central moments of the character (see
<a href="moments_region_central.html"><code><span data-if="hdevelop" style="display:inline">moments_region_central</span><span data-if="c" style="display:none">moments_region_central</span><span data-if="cpp" style="display:none">MomentsRegionCentral</span><span data-if="com" style="display:none">MomentsRegionCentral</span><span data-if="dotnet" style="display:none">MomentsRegionCentral</span><span data-if="python" style="display:none">moments_region_central</span></code></a>, 4 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'moments_gray_plane'</span><span data-if="c" style="display:none">"moments_gray_plane"</span><span data-if="cpp" style="display:none">"moments_gray_plane"</span><span data-if="com" style="display:none">"moments_gray_plane"</span><span data-if="dotnet" style="display:none">"moments_gray_plane"</span><span data-if="python" style="display:none">"moments_gray_plane"</span></i>:</b></dt>
<dd>
<p>

Normalized gray value moments and the angle of the gray value
plane (see <a href="moments_gray_plane.html"><code><span data-if="hdevelop" style="display:inline">moments_gray_plane</span><span data-if="c" style="display:none">moments_gray_plane</span><span data-if="cpp" style="display:none">MomentsGrayPlane</span><span data-if="com" style="display:none">MomentsGrayPlane</span><span data-if="dotnet" style="display:none">MomentsGrayPlane</span><span data-if="python" style="display:none">moments_gray_plane</span></code></a>, 4 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'phi'</span><span data-if="c" style="display:none">"phi"</span><span data-if="cpp" style="display:none">"phi"</span><span data-if="com" style="display:none">"phi"</span><span data-if="dotnet" style="display:none">"phi"</span><span data-if="python" style="display:none">"phi"</span></i>:</b></dt>
<dd>
<p>

Sinus and cosinus of the orientation (angle) of the character
(see <a href="elliptic_axis.html"><code><span data-if="hdevelop" style="display:inline">elliptic_axis</span><span data-if="c" style="display:none">elliptic_axis</span><span data-if="cpp" style="display:none">EllipticAxis</span><span data-if="com" style="display:none">EllipticAxis</span><span data-if="dotnet" style="display:none">EllipticAxis</span><span data-if="python" style="display:none">elliptic_axis</span></code></a>, 2 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'num_connect'</span><span data-if="c" style="display:none">"num_connect"</span><span data-if="cpp" style="display:none">"num_connect"</span><span data-if="com" style="display:none">"num_connect"</span><span data-if="dotnet" style="display:none">"num_connect"</span><span data-if="python" style="display:none">"num_connect"</span></i>:</b></dt>
<dd>
<p>

Number of connected components (see <a href="connect_and_holes.html"><code><span data-if="hdevelop" style="display:inline">connect_and_holes</span><span data-if="c" style="display:none">connect_and_holes</span><span data-if="cpp" style="display:none">ConnectAndHoles</span><span data-if="com" style="display:none">ConnectAndHoles</span><span data-if="dotnet" style="display:none">ConnectAndHoles</span><span data-if="python" style="display:none">connect_and_holes</span></code></a>, 1
feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'num_holes'</span><span data-if="c" style="display:none">"num_holes"</span><span data-if="cpp" style="display:none">"num_holes"</span><span data-if="com" style="display:none">"num_holes"</span><span data-if="dotnet" style="display:none">"num_holes"</span><span data-if="python" style="display:none">"num_holes"</span></i>:</b></dt>
<dd>
<p>

Number of holes (see <a href="connect_and_holes.html"><code><span data-if="hdevelop" style="display:inline">connect_and_holes</span><span data-if="c" style="display:none">connect_and_holes</span><span data-if="cpp" style="display:none">ConnectAndHoles</span><span data-if="com" style="display:none">ConnectAndHoles</span><span data-if="dotnet" style="display:none">ConnectAndHoles</span><span data-if="python" style="display:none">connect_and_holes</span></code></a>, 1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'cooc'</span><span data-if="c" style="display:none">"cooc"</span><span data-if="cpp" style="display:none">"cooc"</span><span data-if="com" style="display:none">"cooc"</span><span data-if="dotnet" style="display:none">"cooc"</span><span data-if="python" style="display:none">"cooc"</span></i>:</b></dt>
<dd>
<p>

Values of the binary cooccurrence matrix (see
<a href="gen_cooc_matrix.html"><code><span data-if="hdevelop" style="display:inline">gen_cooc_matrix</span><span data-if="c" style="display:none">gen_cooc_matrix</span><span data-if="cpp" style="display:none">GenCoocMatrix</span><span data-if="com" style="display:none">GenCoocMatrix</span><span data-if="dotnet" style="display:none">GenCoocMatrix</span><span data-if="python" style="display:none">gen_cooc_matrix</span></code></a>, 8 features).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'num_runs'</span><span data-if="c" style="display:none">"num_runs"</span><span data-if="cpp" style="display:none">"num_runs"</span><span data-if="com" style="display:none">"num_runs"</span><span data-if="dotnet" style="display:none">"num_runs"</span><span data-if="python" style="display:none">"num_runs"</span></i>:</b></dt>
<dd>
<p>

Number of runs in the region normalized by the height (1 feature).
</p>
</dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'chord_histo'</span><span data-if="c" style="display:none">"chord_histo"</span><span data-if="cpp" style="display:none">"chord_histo"</span><span data-if="com" style="display:none">"chord_histo"</span><span data-if="dotnet" style="display:none">"chord_histo"</span><span data-if="python" style="display:none">"chord_histo"</span></i>:</b></dt>
<dd>
<p>

Frequency of the runs per row (not scale-invariant,
<a href="#HeightCharacter"><i><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></i></a> features).
</p>
</dd>
</dl>
<p>After the classifier has been created, it is trained using
<a href="trainf_ocr_class_knn.html"><code><span data-if="hdevelop" style="display:inline">trainf_ocr_class_knn</span><span data-if="c" style="display:none">trainf_ocr_class_knn</span><span data-if="cpp" style="display:none">TrainfOcrClassKnn</span><span data-if="com" style="display:none">TrainfOcrClassKnn</span><span data-if="dotnet" style="display:none">TrainfOcrClassKnn</span><span data-if="python" style="display:none">trainf_ocr_class_knn</span></code></a>.  After this, the classifier can be
saved using <a href="write_ocr_class_knn.html"><code><span data-if="hdevelop" style="display:inline">write_ocr_class_knn</span><span data-if="c" style="display:none">write_ocr_class_knn</span><span data-if="cpp" style="display:none">WriteOcrClassKnn</span><span data-if="com" style="display:none">WriteOcrClassKnn</span><span data-if="dotnet" style="display:none">WriteOcrClassKnn</span><span data-if="python" style="display:none">write_ocr_class_knn</span></code></a>.  Alternatively, the
classifier can be used immediately after training to classify
characters using <a href="do_ocr_single_class_knn.html"><code><span data-if="hdevelop" style="display:inline">do_ocr_single_class_knn</span><span data-if="c" style="display:none">do_ocr_single_class_knn</span><span data-if="cpp" style="display:none">DoOcrSingleClassKnn</span><span data-if="com" style="display:none">DoOcrSingleClassKnn</span><span data-if="dotnet" style="display:none">DoOcrSingleClassKnn</span><span data-if="python" style="display:none">do_ocr_single_class_knn</span></code></a> or
<a href="do_ocr_multi_class_knn.html"><code><span data-if="hdevelop" style="display:inline">do_ocr_multi_class_knn</span><span data-if="c" style="display:none">do_ocr_multi_class_knn</span><span data-if="cpp" style="display:none">DoOcrMultiClassKnn</span><span data-if="com" style="display:none">DoOcrMultiClassKnn</span><span data-if="dotnet" style="display:none">DoOcrMultiClassKnn</span><span data-if="python" style="display:none">do_ocr_multi_class_knn</span></code></a>.
</p>
<p>A comparison of the k-NN and the support vector machine (SVM) (see
<a href="create_ocr_class_svm.html"><code><span data-if="hdevelop" style="display:inline">create_ocr_class_svm</span><span data-if="c" style="display:none">create_ocr_class_svm</span><span data-if="cpp" style="display:none">CreateOcrClassSvm</span><span data-if="com" style="display:none">CreateOcrClassSvm</span><span data-if="dotnet" style="display:none">CreateOcrClassSvm</span><span data-if="python" style="display:none">create_ocr_class_svm</span></code></a>) typically shows that SVMs are
generally slower at training, especially for huge training sets, but
achieve slightly better recognition rates than k-NNs. Please note that
this guideline assumes optimal tuning of the parameters of the SVM.</p>
<h2 id="sec_execution">运行信息</h2>
<ul>
  <li>多线程类型:可重入(与非独占操作符并行运行)。</li>
<li>多线程作用域:全局(可以从任何线程调用)。</li>
  <li>未经并行化处理。</li>
</ul>
<p>This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.</p>
<h2 id="sec_parameters">参数表</h2>
  <div class="par">
<div class="parhead">
<span id="WidthCharacter" class="parname"><b><code><span data-if="hdevelop" style="display:inline">WidthCharacter</span><span data-if="c" style="display:none">WidthCharacter</span><span data-if="cpp" style="display:none">WidthCharacter</span><span data-if="com" style="display:none">WidthCharacter</span><span data-if="dotnet" style="display:none">widthCharacter</span><span data-if="python" style="display:none">width_character</span></code></b> (input_control)  </span><span>integer <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">int</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (integer)</span><span data-if="dotnet" style="display:none"> (<i>int</i> / </span><span data-if="dotnet" style="display:none">long)</span><span data-if="cpp" style="display:none"> (<i>Hlong</i>)</span><span data-if="c" style="display:none"> (<i>Hlong</i>)</span></span>
</div>
<p class="pardesc">Width of the rectangle to which the gray values
of the segmented character are zoomed.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>8</p>
<p class="pardesc"><span class="parcat">Suggested values:
      </span>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20</p>
<p class="pardesc"><span class="parcat">Value range:
      </span><code>4
          ≤
        
    <span data-if="hdevelop" style="display:inline">WidthCharacter</span>
    <span data-if="c" style="display:none">WidthCharacter</span>
    <span data-if="cpp" style="display:none">WidthCharacter</span>
    <span data-if="com" style="display:none">WidthCharacter</span>
    <span data-if="dotnet" style="display:none">widthCharacter</span>
    <span data-if="python" style="display:none">width_character</span>
    
          ≤
          20</code></p>
</div>
  <div class="par">
<div class="parhead">
<span id="HeightCharacter" class="parname"><b><code><span data-if="hdevelop" style="display:inline">HeightCharacter</span><span data-if="c" style="display:none">HeightCharacter</span><span data-if="cpp" style="display:none">HeightCharacter</span><span data-if="com" style="display:none">HeightCharacter</span><span data-if="dotnet" style="display:none">heightCharacter</span><span data-if="python" style="display:none">height_character</span></code></b> (input_control)  </span><span>integer <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">int</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (integer)</span><span data-if="dotnet" style="display:none"> (<i>int</i> / </span><span data-if="dotnet" style="display:none">long)</span><span data-if="cpp" style="display:none"> (<i>Hlong</i>)</span><span data-if="c" style="display:none"> (<i>Hlong</i>)</span></span>
</div>
<p class="pardesc">Height of the rectangle to which the gray values
of the segmented character are zoomed.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>10</p>
<p class="pardesc"><span class="parcat">Suggested values:
      </span>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20</p>
<p class="pardesc"><span class="parcat">Value range:
      </span><code>4
          ≤
        
    <span data-if="hdevelop" style="display:inline">HeightCharacter</span>
    <span data-if="c" style="display:none">HeightCharacter</span>
    <span data-if="cpp" style="display:none">HeightCharacter</span>
    <span data-if="com" style="display:none">HeightCharacter</span>
    <span data-if="dotnet" style="display:none">heightCharacter</span>
    <span data-if="python" style="display:none">height_character</span>
    
          ≤
          20</code></p>
</div>
  <div class="par">
<div class="parhead">
<span id="Interpolation" class="parname"><b><code><span data-if="hdevelop" style="display:inline">Interpolation</span><span data-if="c" style="display:none">Interpolation</span><span data-if="cpp" style="display:none">Interpolation</span><span data-if="com" style="display:none">Interpolation</span><span data-if="dotnet" style="display:none">interpolation</span><span data-if="python" style="display:none">interpolation</span></code></b> (input_control)  </span><span>string <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">str</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (string)</span><span data-if="dotnet" style="display:none"> (<i>string</i>)</span><span data-if="cpp" style="display:none"> (<i>HString</i>)</span><span data-if="c" style="display:none"> (<i>char*</i>)</span></span>
</div>
<p class="pardesc">Interpolation mode for the zooming of the characters.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>
    <span data-if="hdevelop" style="display:inline">'constant'</span>
    <span data-if="c" style="display:none">"constant"</span>
    <span data-if="cpp" style="display:none">"constant"</span>
    <span data-if="com" style="display:none">"constant"</span>
    <span data-if="dotnet" style="display:none">"constant"</span>
    <span data-if="python" style="display:none">"constant"</span>
</p>
<p class="pardesc"><span class="parcat">List of values:
      </span><span data-if="hdevelop" style="display:inline">'bicubic'</span><span data-if="c" style="display:none">"bicubic"</span><span data-if="cpp" style="display:none">"bicubic"</span><span data-if="com" style="display:none">"bicubic"</span><span data-if="dotnet" style="display:none">"bicubic"</span><span data-if="python" style="display:none">"bicubic"</span>, <span data-if="hdevelop" style="display:inline">'bilinear'</span><span data-if="c" style="display:none">"bilinear"</span><span data-if="cpp" style="display:none">"bilinear"</span><span data-if="com" style="display:none">"bilinear"</span><span data-if="dotnet" style="display:none">"bilinear"</span><span data-if="python" style="display:none">"bilinear"</span>, <span data-if="hdevelop" style="display:inline">'constant'</span><span data-if="c" style="display:none">"constant"</span><span data-if="cpp" style="display:none">"constant"</span><span data-if="com" style="display:none">"constant"</span><span data-if="dotnet" style="display:none">"constant"</span><span data-if="python" style="display:none">"constant"</span>, <span data-if="hdevelop" style="display:inline">'nearest_neighbor'</span><span data-if="c" style="display:none">"nearest_neighbor"</span><span data-if="cpp" style="display:none">"nearest_neighbor"</span><span data-if="com" style="display:none">"nearest_neighbor"</span><span data-if="dotnet" style="display:none">"nearest_neighbor"</span><span data-if="python" style="display:none">"nearest_neighbor"</span>, <span data-if="hdevelop" style="display:inline">'weighted'</span><span data-if="c" style="display:none">"weighted"</span><span data-if="cpp" style="display:none">"weighted"</span><span data-if="com" style="display:none">"weighted"</span><span data-if="dotnet" style="display:none">"weighted"</span><span data-if="python" style="display:none">"weighted"</span></p>
</div>
  <div class="par">
<div class="parhead">
<span id="Features" class="parname"><b><code><span data-if="hdevelop" style="display:inline">特征</span><span data-if="c" style="display:none">特征</span><span data-if="cpp" style="display:none">特征</span><span data-if="com" style="display:none">特征</span><span data-if="dotnet" style="display:none">特征</span><span data-if="python" style="display:none">特征</span></code></b> (input_control)  </span><span>string(-array) <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">MaybeSequence[str]</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (string)</span><span data-if="dotnet" style="display:none"> (<i>string</i>)</span><span data-if="cpp" style="display:none"> (<i>HString</i>)</span><span data-if="c" style="display:none"> (<i>char*</i>)</span></span>
</div>
<p class="pardesc">Features to be used for classification.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>
    <span data-if="hdevelop" style="display:inline">'default'</span>
    <span data-if="c" style="display:none">"default"</span>
    <span data-if="cpp" style="display:none">"default"</span>
    <span data-if="com" style="display:none">"default"</span>
    <span data-if="dotnet" style="display:none">"default"</span>
    <span data-if="python" style="display:none">"default"</span>
</p>
<p class="pardesc"><span class="parcat">List of values:
      </span><span data-if="hdevelop" style="display:inline">'anisometry'</span><span data-if="c" style="display:none">"anisometry"</span><span data-if="cpp" style="display:none">"anisometry"</span><span data-if="com" style="display:none">"anisometry"</span><span data-if="dotnet" style="display:none">"anisometry"</span><span data-if="python" style="display:none">"anisometry"</span>, <span data-if="hdevelop" style="display:inline">'chord_histo'</span><span data-if="c" style="display:none">"chord_histo"</span><span data-if="cpp" style="display:none">"chord_histo"</span><span data-if="com" style="display:none">"chord_histo"</span><span data-if="dotnet" style="display:none">"chord_histo"</span><span data-if="python" style="display:none">"chord_histo"</span>, <span data-if="hdevelop" style="display:inline">'compactness'</span><span data-if="c" style="display:none">"compactness"</span><span data-if="cpp" style="display:none">"compactness"</span><span data-if="com" style="display:none">"compactness"</span><span data-if="dotnet" style="display:none">"compactness"</span><span data-if="python" style="display:none">"compactness"</span>, <span data-if="hdevelop" style="display:inline">'convexity'</span><span data-if="c" style="display:none">"convexity"</span><span data-if="cpp" style="display:none">"convexity"</span><span data-if="com" style="display:none">"convexity"</span><span data-if="dotnet" style="display:none">"convexity"</span><span data-if="python" style="display:none">"convexity"</span>, <span data-if="hdevelop" style="display:inline">'cooc'</span><span data-if="c" style="display:none">"cooc"</span><span data-if="cpp" style="display:none">"cooc"</span><span data-if="com" style="display:none">"cooc"</span><span data-if="dotnet" style="display:none">"cooc"</span><span data-if="python" style="display:none">"cooc"</span>, <span data-if="hdevelop" style="display:inline">'default'</span><span data-if="c" style="display:none">"default"</span><span data-if="cpp" style="display:none">"default"</span><span data-if="com" style="display:none">"default"</span><span data-if="dotnet" style="display:none">"default"</span><span data-if="python" style="display:none">"default"</span>, <span data-if="hdevelop" style="display:inline">'foreground'</span><span data-if="c" style="display:none">"foreground"</span><span data-if="cpp" style="display:none">"foreground"</span><span data-if="com" style="display:none">"foreground"</span><span data-if="dotnet" style="display:none">"foreground"</span><span data-if="python" style="display:none">"foreground"</span>, <span data-if="hdevelop" style="display:inline">'foreground_grid_16'</span><span data-if="c" style="display:none">"foreground_grid_16"</span><span data-if="cpp" style="display:none">"foreground_grid_16"</span><span data-if="com" style="display:none">"foreground_grid_16"</span><span data-if="dotnet" style="display:none">"foreground_grid_16"</span><span data-if="python" style="display:none">"foreground_grid_16"</span>, <span data-if="hdevelop" style="display:inline">'foreground_grid_9'</span><span data-if="c" style="display:none">"foreground_grid_9"</span><span data-if="cpp" style="display:none">"foreground_grid_9"</span><span data-if="com" style="display:none">"foreground_grid_9"</span><span data-if="dotnet" style="display:none">"foreground_grid_9"</span><span data-if="python" style="display:none">"foreground_grid_9"</span>, <span data-if="hdevelop" style="display:inline">'gradient_8dir'</span><span data-if="c" style="display:none">"gradient_8dir"</span><span data-if="cpp" style="display:none">"gradient_8dir"</span><span data-if="com" style="display:none">"gradient_8dir"</span><span data-if="dotnet" style="display:none">"gradient_8dir"</span><span data-if="python" style="display:none">"gradient_8dir"</span>, <span data-if="hdevelop" style="display:inline">'height'</span><span data-if="c" style="display:none">"height"</span><span data-if="cpp" style="display:none">"height"</span><span data-if="com" style="display:none">"height"</span><span data-if="dotnet" style="display:none">"height"</span><span data-if="python" style="display:none">"height"</span>, <span data-if="hdevelop" style="display:inline">'moments_central'</span><span data-if="c" style="display:none">"moments_central"</span><span data-if="cpp" style="display:none">"moments_central"</span><span data-if="com" style="display:none">"moments_central"</span><span data-if="dotnet" style="display:none">"moments_central"</span><span data-if="python" style="display:none">"moments_central"</span>, <span data-if="hdevelop" style="display:inline">'moments_gray_plane'</span><span data-if="c" style="display:none">"moments_gray_plane"</span><span data-if="cpp" style="display:none">"moments_gray_plane"</span><span data-if="com" style="display:none">"moments_gray_plane"</span><span data-if="dotnet" style="display:none">"moments_gray_plane"</span><span data-if="python" style="display:none">"moments_gray_plane"</span>, <span data-if="hdevelop" style="display:inline">'moments_region_2nd_invar'</span><span data-if="c" style="display:none">"moments_region_2nd_invar"</span><span data-if="cpp" style="display:none">"moments_region_2nd_invar"</span><span data-if="com" style="display:none">"moments_region_2nd_invar"</span><span data-if="dotnet" style="display:none">"moments_region_2nd_invar"</span><span data-if="python" style="display:none">"moments_region_2nd_invar"</span>, <span data-if="hdevelop" style="display:inline">'moments_region_2nd_rel_invar'</span><span data-if="c" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="cpp" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="com" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="dotnet" style="display:none">"moments_region_2nd_rel_invar"</span><span data-if="python" style="display:none">"moments_region_2nd_rel_invar"</span>, <span data-if="hdevelop" style="display:inline">'moments_region_3rd_invar'</span><span data-if="c" style="display:none">"moments_region_3rd_invar"</span><span data-if="cpp" style="display:none">"moments_region_3rd_invar"</span><span data-if="com" style="display:none">"moments_region_3rd_invar"</span><span data-if="dotnet" style="display:none">"moments_region_3rd_invar"</span><span data-if="python" style="display:none">"moments_region_3rd_invar"</span>, <span data-if="hdevelop" style="display:inline">'num_connect'</span><span data-if="c" style="display:none">"num_connect"</span><span data-if="cpp" style="display:none">"num_connect"</span><span data-if="com" style="display:none">"num_connect"</span><span data-if="dotnet" style="display:none">"num_connect"</span><span data-if="python" style="display:none">"num_connect"</span>, <span data-if="hdevelop" style="display:inline">'num_holes'</span><span data-if="c" style="display:none">"num_holes"</span><span data-if="cpp" style="display:none">"num_holes"</span><span data-if="com" style="display:none">"num_holes"</span><span data-if="dotnet" style="display:none">"num_holes"</span><span data-if="python" style="display:none">"num_holes"</span>, <span data-if="hdevelop" style="display:inline">'num_runs'</span><span data-if="c" style="display:none">"num_runs"</span><span data-if="cpp" style="display:none">"num_runs"</span><span data-if="com" style="display:none">"num_runs"</span><span data-if="dotnet" style="display:none">"num_runs"</span><span data-if="python" style="display:none">"num_runs"</span>, <span data-if="hdevelop" style="display:inline">'phi'</span><span data-if="c" style="display:none">"phi"</span><span data-if="cpp" style="display:none">"phi"</span><span data-if="com" style="display:none">"phi"</span><span data-if="dotnet" style="display:none">"phi"</span><span data-if="python" style="display:none">"phi"</span>, <span data-if="hdevelop" style="display:inline">'pixel'</span><span data-if="c" style="display:none">"pixel"</span><span data-if="cpp" style="display:none">"pixel"</span><span data-if="com" style="display:none">"pixel"</span><span data-if="dotnet" style="display:none">"pixel"</span><span data-if="python" style="display:none">"pixel"</span>, <span data-if="hdevelop" style="display:inline">'pixel_binary'</span><span data-if="c" style="display:none">"pixel_binary"</span><span data-if="cpp" style="display:none">"pixel_binary"</span><span data-if="com" style="display:none">"pixel_binary"</span><span data-if="dotnet" style="display:none">"pixel_binary"</span><span data-if="python" style="display:none">"pixel_binary"</span>, <span data-if="hdevelop" style="display:inline">'pixel_invar'</span><span data-if="c" style="display:none">"pixel_invar"</span><span data-if="cpp" style="display:none">"pixel_invar"</span><span data-if="com" style="display:none">"pixel_invar"</span><span data-if="dotnet" style="display:none">"pixel_invar"</span><span data-if="python" style="display:none">"pixel_invar"</span>, <span data-if="hdevelop" style="display:inline">'projection_horizontal'</span><span data-if="c" style="display:none">"projection_horizontal"</span><span data-if="cpp" style="display:none">"projection_horizontal"</span><span data-if="com" style="display:none">"projection_horizontal"</span><span data-if="dotnet" style="display:none">"projection_horizontal"</span><span data-if="python" style="display:none">"projection_horizontal"</span>, <span data-if="hdevelop" style="display:inline">'projection_horizontal_invar'</span><span data-if="c" style="display:none">"projection_horizontal_invar"</span><span data-if="cpp" style="display:none">"projection_horizontal_invar"</span><span data-if="com" style="display:none">"projection_horizontal_invar"</span><span data-if="dotnet" style="display:none">"projection_horizontal_invar"</span><span data-if="python" style="display:none">"projection_horizontal_invar"</span>, <span data-if="hdevelop" style="display:inline">'projection_vertical'</span><span data-if="c" style="display:none">"projection_vertical"</span><span data-if="cpp" style="display:none">"projection_vertical"</span><span data-if="com" style="display:none">"projection_vertical"</span><span data-if="dotnet" style="display:none">"projection_vertical"</span><span data-if="python" style="display:none">"projection_vertical"</span>, <span data-if="hdevelop" style="display:inline">'projection_vertical_invar'</span><span data-if="c" style="display:none">"projection_vertical_invar"</span><span data-if="cpp" style="display:none">"projection_vertical_invar"</span><span data-if="com" style="display:none">"projection_vertical_invar"</span><span data-if="dotnet" style="display:none">"projection_vertical_invar"</span><span data-if="python" style="display:none">"projection_vertical_invar"</span>, <span data-if="hdevelop" style="display:inline">'ratio'</span><span data-if="c" style="display:none">"ratio"</span><span data-if="cpp" style="display:none">"ratio"</span><span data-if="com" style="display:none">"ratio"</span><span data-if="dotnet" style="display:none">"ratio"</span><span data-if="python" style="display:none">"ratio"</span>, <span data-if="hdevelop" style="display:inline">'width'</span><span data-if="c" style="display:none">"width"</span><span data-if="cpp" style="display:none">"width"</span><span data-if="com" style="display:none">"width"</span><span data-if="dotnet" style="display:none">"width"</span><span data-if="python" style="display:none">"width"</span>, <span data-if="hdevelop" style="display:inline">'zoom_factor'</span><span data-if="c" style="display:none">"zoom_factor"</span><span data-if="cpp" style="display:none">"zoom_factor"</span><span data-if="com" style="display:none">"zoom_factor"</span><span data-if="dotnet" style="display:none">"zoom_factor"</span><span data-if="python" style="display:none">"zoom_factor"</span></p>
</div>
  <div class="par">
<div class="parhead">
<span id="Characters" class="parname"><b><code><span data-if="hdevelop" style="display:inline">Characters</span><span data-if="c" style="display:none">Characters</span><span data-if="cpp" style="display:none">Characters</span><span data-if="com" style="display:none">Characters</span><span data-if="dotnet" style="display:none">characters</span><span data-if="python" style="display:none">characters</span></code></b> (input_control)  </span><span>string-array <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">Sequence[str]</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (string)</span><span data-if="dotnet" style="display:none"> (<i>string</i>)</span><span data-if="cpp" style="display:none"> (<i>HString</i>)</span><span data-if="c" style="display:none"> (<i>char*</i>)</span></span>
</div>
<p class="pardesc">All characters of the character set to be read.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>
    <span data-if="hdevelop" style="display:inline">['0','1','2','3','4','5','6','7','8','9']</span>
    <span data-if="c" style="display:none">["0","1","2","3","4","5","6","7","8","9"]</span>
    <span data-if="cpp" style="display:none">["0","1","2","3","4","5","6","7","8","9"]</span>
    <span data-if="com" style="display:none">["0","1","2","3","4","5","6","7","8","9"]</span>
    <span data-if="dotnet" style="display:none">["0","1","2","3","4","5","6","7","8","9"]</span>
    <span data-if="python" style="display:none">["0","1","2","3","4","5","6","7","8","9"]</span>
</p>
</div>
  <div class="par">
<div class="parhead">
<span id="GenParamName" class="parname"><b><code><span data-if="hdevelop" style="display:inline">GenParamName</span><span data-if="c" style="display:none">GenParamName</span><span data-if="cpp" style="display:none">GenParamName</span><span data-if="com" style="display:none">GenParamName</span><span data-if="dotnet" style="display:none">genParamName</span><span data-if="python" style="display:none">gen_param_name</span></code></b> (input_control)  </span><span>string-array <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">Sequence[str]</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (string)</span><span data-if="dotnet" style="display:none"> (<i>string</i>)</span><span data-if="cpp" style="display:none"> (<i>HString</i>)</span><span data-if="c" style="display:none"> (<i>char*</i>)</span></span>
</div>
<p class="pardesc">This parameter is not yet supported.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>[]</p>
<p class="pardesc"><span class="parcat">List of values:
      </span>[]</p>
</div>
  <div class="par">
<div class="parhead">
<span id="GenParamValue" class="parname"><b><code><span data-if="hdevelop" style="display:inline">GenParamValue</span><span data-if="c" style="display:none">GenParamValue</span><span data-if="cpp" style="display:none">GenParamValue</span><span data-if="com" style="display:none">GenParamValue</span><span data-if="dotnet" style="display:none">genParamValue</span><span data-if="python" style="display:none">gen_param_value</span></code></b> (input_control)  </span><span>number-array <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">Sequence[Union[int, str]]</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (integer / </span><span data-if="hdevelop" style="display:inline">string)</span><span data-if="dotnet" style="display:none"> (<i>int</i> / </span><span data-if="dotnet" style="display:none">long / </span><span data-if="dotnet" style="display:none">string)</span><span data-if="cpp" style="display:none"> (<i>Hlong</i> / </span><span data-if="cpp" style="display:none">HString)</span><span data-if="c" style="display:none"> (<i>Hlong</i> / </span><span data-if="c" style="display:none">char*)</span></span>
</div>
<p class="pardesc">This parameter is not yet supported.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>[]</p>
<p class="pardesc"><span class="parcat">List of values:
      </span>[]</p>
</div>
  <div class="par">
<div class="parhead">
<span id="OCRHandle" class="parname"><b><code><span data-if="hdevelop" style="display:inline">OCRHandle</span><span data-if="c" style="display:none">OCRHandle</span><span data-if="cpp" style="display:none">OCRHandle</span><span data-if="com" style="display:none">OCRHandle</span><span data-if="dotnet" style="display:none">OCRHandle</span><span data-if="python" style="display:none">ocrhandle</span></code></b> (output_control)  </span><span>ocr_knn <code>→</code> <span data-if="dotnet" style="display:none"><a href="HOCRKnn.html">HOCRKnn</a>, </span><span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">HHandle</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (handle)</span><span data-if="dotnet" style="display:none"> (<i>IntPtr</i>)</span><span data-if="cpp" style="display:none"> (<i>HHandle</i>)</span><span data-if="c" style="display:none"> (<i>handle</i>)</span></span>
</div>
<p class="pardesc">Handle of the k-NN classifier.</p>
</div>
<h2 id="sec_example_all">例程 (HDevelop)</h2>
<pre class="example">
read_image (Image, 'letters')
* Segment the image.
binary_threshold(Image,&amp;Region, 'otsu', 'dark', &amp;UsedThreshold);
dilation_circle (Region, RegionDilation, 3.5)
connection (RegionDilation, ConnectedRegions)
intersection (ConnectedRegions, Region, RegionIntersection)
sort_region (RegionIntersection, Characters, 'character', 'true', 'row')
* Generate the training file.
count_obj (Characters, Number)
Classes := []
for J := 0 to 25 by 1
    Classes := [Classes,gen_tuple_const(20,chr(ord('a')+J))]
endfor
Classes := [Classes,gen_tuple_const(20,'.')]
write_ocr_trainf (Characters, Image, Classes, 'letters.trf')
* Generate and train the classifier.
read_ocr_trainf_names ('letters.trf', CharacterNames, CharacterCount)
create_ocr_class_knn (8, 10, 'constant', 'default', CharacterNames, \
                      [], [], OCRHandle)
trainf_ocr_class_knn (OCRHandle, 'letters.trf', [], [])
* Re-classify the characters in the image.
do_ocr_multi_class_knn (Characters, Image, OCRHandle, Class, Confidence)
</pre>
<h2 id="sec_result">结果</h2>
<p>如果参数均有效，算子
<code><span data-if="hdevelop" style="display:inline">create_ocr_class_knn</span><span data-if="c" style="display:none">create_ocr_class_knn</span><span data-if="cpp" style="display:none">CreateOcrClassKnn</span><span data-if="com" style="display:none">CreateOcrClassKnn</span><span data-if="dotnet" style="display:none">CreateOcrClassKnn</span><span data-if="python" style="display:none">create_ocr_class_knn</span></code> 返回值 <TT>2</TT> (
      <TT>H_MSG_TRUE</TT>)
    .  If necessary,
an exception is raised.</p>
<h2 id="sec_successors">可能的后置算子</h2>
<p>
<code><a href="trainf_ocr_class_knn.html"><span data-if="hdevelop" style="display:inline">trainf_ocr_class_knn</span><span data-if="c" style="display:none">trainf_ocr_class_knn</span><span data-if="cpp" style="display:none">TrainfOcrClassKnn</span><span data-if="com" style="display:none">TrainfOcrClassKnn</span><span data-if="dotnet" style="display:none">TrainfOcrClassKnn</span><span data-if="python" style="display:none">trainf_ocr_class_knn</span></a></code>
</p>
<h2 id="sec_alternatives">可替代算子</h2>
<p>
<code><a href="create_ocr_class_svm.html"><span data-if="hdevelop" style="display:inline">create_ocr_class_svm</span><span data-if="c" style="display:none">create_ocr_class_svm</span><span data-if="cpp" style="display:none">CreateOcrClassSvm</span><span data-if="com" style="display:none">CreateOcrClassSvm</span><span data-if="dotnet" style="display:none">CreateOcrClassSvm</span><span data-if="python" style="display:none">create_ocr_class_svm</span></a></code>
</p>
<h2 id="sec_see">参考其它</h2>
<p>
<code><a href="do_ocr_single_class_knn.html"><span data-if="hdevelop" style="display:inline">do_ocr_single_class_knn</span><span data-if="c" style="display:none">do_ocr_single_class_knn</span><span data-if="cpp" style="display:none">DoOcrSingleClassKnn</span><span data-if="com" style="display:none">DoOcrSingleClassKnn</span><span data-if="dotnet" style="display:none">DoOcrSingleClassKnn</span><span data-if="python" style="display:none">do_ocr_single_class_knn</span></a></code>, 
<code><a href="do_ocr_multi_class_knn.html"><span data-if="hdevelop" style="display:inline">do_ocr_multi_class_knn</span><span data-if="c" style="display:none">do_ocr_multi_class_knn</span><span data-if="cpp" style="display:none">DoOcrMultiClassKnn</span><span data-if="com" style="display:none">DoOcrMultiClassKnn</span><span data-if="dotnet" style="display:none">DoOcrMultiClassKnn</span><span data-if="python" style="display:none">do_ocr_multi_class_knn</span></a></code>, 
<code><a href="clear_class_knn.html"><span data-if="hdevelop" style="display:inline">clear_class_knn</span><span data-if="c" style="display:none">clear_class_knn</span><span data-if="cpp" style="display:none">ClearClassKnn</span><span data-if="com" style="display:none">ClearClassKnn</span><span data-if="dotnet" style="display:none">ClearClassKnn</span><span data-if="python" style="display:none">clear_class_knn</span></a></code>, 
<code><a href="create_class_knn.html"><span data-if="hdevelop" style="display:inline">create_class_knn</span><span data-if="c" style="display:none">create_class_knn</span><span data-if="cpp" style="display:none">CreateClassKnn</span><span data-if="com" style="display:none">CreateClassKnn</span><span data-if="dotnet" style="display:none">CreateClassKnn</span><span data-if="python" style="display:none">create_class_knn</span></a></code>, 
<code><a href="trainf_ocr_class_knn.html"><span data-if="hdevelop" style="display:inline">trainf_ocr_class_knn</span><span data-if="c" style="display:none">trainf_ocr_class_knn</span><span data-if="cpp" style="display:none">TrainfOcrClassKnn</span><span data-if="com" style="display:none">TrainfOcrClassKnn</span><span data-if="dotnet" style="display:none">TrainfOcrClassKnn</span><span data-if="python" style="display:none">trainf_ocr_class_knn</span></a></code>, 
<code><a href="classify_class_knn.html"><span data-if="hdevelop" style="display:inline">classify_class_knn</span><span data-if="c" style="display:none">classify_class_knn</span><span data-if="cpp" style="display:none">ClassifyClassKnn</span><span data-if="com" style="display:none">ClassifyClassKnn</span><span data-if="dotnet" style="display:none">ClassifyClassKnn</span><span data-if="python" style="display:none">classify_class_knn</span></a></code>
</p>
<h2 id="sec_module">模块</h2>
<p>
OCR/OCV</p>
<!--OP_REF_FOOTER_START-->
<hr>
<div class="indexlink">
<a href="index_classes.html"><span data-if="dotnet" style="display:none;">类别</span><span data-if="cpp" style="display:none;">类别</span></a><span data-if="dotnet" style="display:none;"> | </span><span data-if="cpp" style="display:none;"> | </span><a href="index_by_name.html">算子列表</a>
</div>
<div class="footer">
<div class="copyright">HALCON算子参考手册 Copyright © 2015-2023 51Halcon</div>
</div>
</div>
</body>
</html>
